import request from "@/utils/request";

// ------------------------------ 收费项目模块 ---------------------------------------------
// 收费项目列表
export const getProjectList = (params) =>
  request.get("/expenses/project", { params });

// 添加收费项目
export const addProject = (data) => request.post("/expenses/project", data);

// 获取收费项目详情
export const getProjectInfo = (id) => request.get("/expenses/project/" + id);

// 编辑收费项目
export const editProject = (data) =>
  request.put(`/expenses/project/${data.id}`, data);

// 删除收费项目
export const delProject = (id) => request.delete("/expenses/project/" + id);

/**
 * --------------------- 收费明细模块（角色管理） --------------------------
 */
// ------------ 搜索 ----------------------
// 搜索---获取房产信息--community_code
export const getHouseIndexList = (code) =>
  request.get(`/house/index?community_code=${code}`);

// 搜索---收费项目列表
export const getProject = (code) =>
  request.get(`/expenses/project?community_code=${code}`);

// ------------ 下拉 --------------------
// 获取所属楼栋 build
export const getBuild = (code) =>
  request.get(`/house/building?community_code=${code}`);
// 获取所属房产
export const getBuildAll = (code) =>
  request.get(`/house/index?building_code=${code}`);
// 房产回显
export const getBuildInfo = (code, id) =>
  request.get(`/house/index?community_code=${code}&building_code=${id}`);
// ---------------- 明细 --------------------------
// 收费明细列表
export const getExpensesIndexList = (params) =>
  request.get("/expenses/index", { params });

// 添加收费明细
export const addExpensesIndex = (data) => request.post("/expenses/index", data);

// 获取收费明细详情
export const getExpensesIndexInfo = (id) =>
  request.get("/expenses/index/" + id);

// 编辑收费明细
export const editExpensesIndex = (data) =>
  request.put(`/expenses/index/${data.id}`, data);

// 删除收费明细
export const delExpensesIndex = (id) => request.delete("/expenses/index/" + id);
